import requests
from config import url, headers_wechat


class Menu:

    def __init__(self):
        self.url = url
        self.headers = headers_wechat

    @classmethod
    def get_menus_roles(cls, url: str, params=None, headers=headers_wechat):
        """
        @Summary:通过角色code获取此角色拥有的菜单
        @Description:1.小程序端根据角色code获得角色菜单
        :param url:
        :param params:
        :param headers:
        """
        url = url + "/authoritycontrolplatformapi/api/v1/menus/roles"
        r = requests.get(url=url, headers=headers, params=params)
        return r

    @classmethod
    def get_menus_miniroles(cls, url: str, params=None, headers=headers_wechat):
        """
        @Summary:通过角色code获取此角色拥有的菜单
        @Description:1.小程序端根据角色code获得角色菜单(快速登陆用户使用)
        :param url:
        :param params:
        :param headers:
        """
        url = url + "/authoritycontrolplatformapi/api/v1/menus/miniprogram/roles"
        r = requests.get(url=url, headers=headers, params=params)
        return r